package com.liuxing.javaSpringBoot.modules.common.controller;

import com.liuxing.javaSpringBoot.modules.common.entity.Result;
import com.liuxing.javaSpringBoot.modules.common.service.ImageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * Created by IntelliJ IDEA.
 * @File ImageController.java
 * @Auth liuxing
 * @Date 2021/8/24 09:54
 * @Email liuxing997@foxmail.com
 */
@RestController
@RequestMapping("/api")
public class ImageController {

    @Autowired
    private ImageService imageService;


    /**
     * 127.0.0.1/api/image/profile-big ---- post
     */
    @PostMapping(value = "/image/{imageType}",consumes = "multipart/form-data")
    public Result<String> uploadImage(@RequestParam MultipartFile file,
                                      @PathVariable String imageType) {
        return imageService.uploadImage(file,imageType);
    }

}
